﻿<%@ Page Title="" Language="C#" MasterPageFile="~/CustomerPanel/Customer.Master" AutoEventWireup="true" CodeBehind="MessageCenter.aspx.cs" Inherits="Fish_Atlantis.CustomerPanel.MessageCenter"  EnableEventValidation="false"%>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
   <style type="text/css">
        .style4
        {
            width: 247px;
            height: 100%;
            top: 0px;
        }
        .style11
        {
            width: 680px;
        }
        .style12
        {
            width: 226px;
        }
        .style15
        {
            width: 236px;
        }
        .style16
        {
            width: 492px;
        }
        .style18
        {
            width: 236px;
            height: 59px;
        }
        .style19
        {
            height: 59px;
            width: 363px;
        }
        .style1
        {
            width: 744px;
        }
        .style22
        {
            width: 146px;
        }
        .style24
        {
            height: 59px;
            width: 621px;
        }
        .style25
        {
            height: 4px;
            width: 76px;
        }
        .style26
        {
            width: 169px;
            height: 149px;
        }
        .style28
        {
            width: 260px;
        }
        .style32
        {
            width: 287px;
        }
        .style33
        {
            width: 159px;
        }
        .style34
        {
            width: 337px;
        }
        </style>
        <link href="/Styles/register-box.css" rel="stylesheet" type="text/css" />   
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
    <asp:Panel ID="Panel1" runat="server" BackColor="#F2ECFF" BorderColor="#66CCFF" 
        BorderStyle="Groove" Width="930px">
        <table style="height: 170px; width: 952px">
        <tr>
        <td class="style1">
    <table class="style1" 
            style="border: medium dotted #99CCFF; font-family: 幼圆; font-size: medium">
            <tr>
                <td  align="right" class="style28" >
                    <asp:Button ID="btnSendSingle" runat="server" BackColor="#66CCFF" 
                        BorderColor="#66CCFF" Font-Size="Large" onclick="btnSendSingle_Click" 
                        Text="发送私人消息" Width="136px" BorderStyle="Dashed" />
                    <asp:Button ID="btnSendMutiple" runat="server" BackColor="#66CCFF" 
                        BorderColor="#66CCFF" Font-Size="Large" onclick="btnSendMutiple_Click" 
                        Text="发送公告" BorderStyle="Dashed" />
                </td>
                <td  align="left" class="style34"  >
                    <asp:Label ID="lblSendTo" runat="server" BorderColor="#9900FF" 
                        Font-Size="Large" ForeColor="Blue" Text="发送对象:"></asp:Label>
                </td>
                <td align="left" class="style33">
                    <asp:DropDownList ID="tbSendTo" runat="server" DataSourceID="UserDataSource" 
                        DataTextField="UserName" DataValueField="UserName" Font-Bold="True" 
                        Font-Names="幼圆" Font-Size="Medium" Height="30px" style="margin-left: 13px" 
                        Width="141px">
                    </asp:DropDownList>
                </td>
                <td align="right" class="style32"  >
                   <asp:Label ID="Label3" runat="server" BorderColor="#9900FF" 
                        Font-Size="Large" ForeColor="Blue" Text="选择渔场："></asp:Label></td>
                <td class="style22" >
                    <asp:DropDownList ID="DropDownList1" runat="server" 
                        DataSourceID="FisherySource1" DataTextField="FisheryName" 
                        DataValueField="FisheryName" Font-Bold="True" Font-Names="幼圆" 
                        Font-Size="Medium" Height="30px" Width="122px">
                    </asp:DropDownList>
                </td>
            </tr>
             </table>
              <table class="style1" 
            
                
                style="border-left: medium dotted #99CCFF; border-right: medium dotted #99CCFF; border-top: medium dashed #FFFFFF; border-bottom: medium dotted #99CCFF; height: 115px;">
            <tr>
                <td class="style18" align="center">
                    <asp:Label ID="lblContent" runat="server" Text="请填写内容：" Font-Size="Large" 
                        BorderColor="#99CCFF" ForeColor="#000099" Font-Names="幼圆" Width="123px"></asp:Label>
                </td>
                <td class="style24" colspan="2">
                    <asp:TextBox ID="tbContent" runat="server" TextMode="MultiLine" Width="471px" 
                        BorderStyle="Groove" Height="84px"  BorderColor="#3399FF" 
                        style="margin-left: 0px"></asp:TextBox>
                </td>
                <td class="style19" colspan="2" align="center">
                    <asp:Button ID="btnSend" runat="server" Font-Bold="False" Font-Size="Large" 
                        onclick="btnSend_Click" Text="发送" />
                </td>
            </tr>
        </table>
        </td>
        <td>
            <img class="style26" src="../Image/SendMessage.jpg" />
        </td>
        </tr>
        </table>
    </asp:Panel>
    <div>
       
       
        <table style="border: medium double #3399FF;  height: 100%;">
            <tr>
                <td class="style4" 
                    style="border: thin solid #99CCFF; ">
                    <div style="position: relative; top: 2px; left: 0px; height: 920px; width: 245px;">
                        <asp:Label ID="Label1" runat="server" Font-Bold="True" Font-Names="幼圆" 
                            Font-Size="X-Large" ForeColor="#000099" Text="公告栏"></asp:Label>
                        <asp:DataList ID="DataList2" runat="server" CellPadding="4" 
                            DataKeyField="MessageID" DataSourceID="CommonSource1" 
                            Width="245px" Font-Bold="True" Font-Names="幼圆" Font-Size="Medium" 
                            onitemcommand="DataList2_ItemCommand" 
                            onitemdatabound="DataList2_ItemDataBound">
                            <AlternatingItemStyle BackColor="White" />
                            <FooterStyle BackColor="#507CD1" ForeColor="White" Font-Bold="True" 
                                Font-Size="Smaller" />
                            <HeaderStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
                            <ItemStyle BackColor="#EFF3FB" />
                            <ItemTemplate>                  
                            <div align="left">    <asp:LinkButton ID="UserNameLabel" runat="server" Text='<%# Eval("UserName") %>' />发布公告：</div>
                                <br />
                                <asp:Label ID="Content_TextLabel" runat="server" 
                                    Text='<%# Eval("Content_Text") %>' />
                                <br />
                               发布时间：
                                <asp:Label ID="TimeLabel" runat="server" Text='<%# Eval("Time") %>' />
                                <asp:Label ID="Label2" runat="server" Text='<%# Eval("MessageID") %>' Visible="False"></asp:Label>
                                <br />
                            </ItemTemplate>
                             <FooterTemplate>
                            <table style="width: 229px; height: 39px;" cellpadding="0" cellspacing="0">
                                <tr> 
                                    <td valign="middle" class="style25">
                                        共<asp:Label ID="labCount" runat="server" ForeColor="#FF3300" Width="12px"/>页</td>
                                    <td style="width: 71px; height: 4px" valign="middle">
                                        当前<asp:Label ID="labNowPage" runat="server" ForeColor="Brown">1</asp:Label>页</td>                                              
                                    <td style="width: 30px; height: 4px" valign="middle">
                                        <asp:LinkButton ID="lnkbtnFirst" runat="server" CommandName="first"
                                            Font-Underline="False" ForeColor="Black" Width="30px">首页</asp:LinkButton></td>
                                    <td style="width: 47px; height: 4px" valign="middle">
                                        <asp:LinkButton ID="lnkbtnFront" runat="server" CommandName="pre" 
                                            Font-Underline="False" ForeColor="Black" Width="47px">上一页</asp:LinkButton></td>
                                    <td style="width: 47px; height: 4px" valign="middle">
                                        <asp:LinkButton ID="lnkbtnNext" runat="server" CommandName="next"
                                            Font-Underline="False" ForeColor="Black" Width="47px" >下一页</asp:LinkButton></td>
                                    <td style="width: 30px; height: 4px" valign="middle">
                                        <asp:LinkButton ID="lnkbtnLast" runat="server" Font-Overline="False" CommandName="last"
                                            Font-Underline="False" ForeColor="Black" Width="30px">尾页</asp:LinkButton></td>                                                                    
                                </tr>
                            </table>
                        </FooterTemplate>
                            <SelectedItemStyle BackColor="#D1DDF1" Font-Bold="True" ForeColor="#333333" />
                        </asp:DataList>
                        <asp:SqlDataSource ID="CommonSource1" runat="server" 
                            ConnectionString="<%$ ConnectionStrings:ConnectionString %>" 
                            SelectCommand="select Message.MessageID,y.UserName,Message.Content_Text,Message.Time from Message,Users y 
where  Message.ReceiverID is null and Message.SenderID=y.UserID order by Message.Message_Type asc,Message.Time desc;"></asp:SqlDataSource>
                    </div>
                </td>
                <td class="style11" style="position: relative; top: 0px; left: 0px;">
                <div style="position: relative; top: 0px; left: 0px; height: 920px;">
                <h1 align="center" 
                    style="font-size: x-large; font-family: 黑体; font-weight: bold; color: #000080">
            <asp:SqlDataSource ID="FisherySource1" runat="server" 
                ConnectionString="<%$ ConnectionStrings:ConnectionString %>" 
                SelectCommand="SELECT [FisheryName] FROM [Fishery]"></asp:SqlDataSource>
                    <asp:SqlDataSource ID="UserDataSource" runat="server" 
                        ConnectionString="<%$ ConnectionStrings:ConnectionString %>" 
                        
                        SelectCommand="SELECT DISTINCT [UserName]FROM [Users] except SELECT DISTINCT [UserName] FROM [Users] where [UserID] = 17"></asp:SqlDataSource>
                    这是您所接受到的私人消息</h1>
        <asp:DataList ID="DataList1" runat="server" DataSourceID="MessageSource1" 
                        style="margin-right: 0px" BackColor="White" BorderColor="#66CCFF" 
                        BorderStyle="Solid" BorderWidth="2px" CellPadding="3" GridLines="Horizontal" 
                        Width="675px" onselectedindexchanged="DataList1_SelectedIndexChanged" 
                        ondeletecommand="DataList1_DeleteCommand" 
                        onitemcommand="DataList1_ItemCommand" 
                        onitemdatabound="DataList1_ItemDataBound">
            <AlternatingItemStyle BackColor="#F7F7F7" />
            <FooterStyle BackColor="#B5C7DE" ForeColor="#4A3C8C" Font-Bold="True" 
                Font-Names="幼圆" Font-Size="Medium" />
            <HeaderStyle BackColor="#4A3C8C" Font-Bold="True" ForeColor="#F7F7F7" />
            <ItemStyle BackColor="#E7E7FF" ForeColor="#4A3C8C" BorderColor="#3399FF" />
            <ItemTemplate>
                <table style="border: medium double #66CCFF; width:100%;" align="left">
                    <tr>
                        <td class="style12" 
                            style="font-family: 幼圆; font-size: larger; font-weight: bold; " 
                            align="left">
                            <img alt="" src="../Image/member.gif" />
                            发表人<asp:LinkButton ID="UserButton1" runat="server"  Text='<%#Eval("UserName")%>' 
                                ></asp:LinkButton>
                            </td>
                        <td class="style15" 
                            style="Font: font-family: 幼圆; font-size: larger; font-weight: bold;" 
                            align="left">
                            渔场名：<asp:Label ID="FisheryLabel" runat="server" Text=""></asp:Label>
                            <asp:Label ID="FisheryID" runat="server" Text='<%# Eval("FisheryID") %>' 
                                Visible="False"></asp:Label>
                        </td>
                        <td style="Font; font-family: 幼圆; font-size: larger; font-weight: bold;" align="left">
                            发表时间：<asp:Label ID="DateLabel" runat="server" Text='<%#Eval("Time")%>'></asp:Label>
                        </td>
                    </tr>
                </table>
                <br>
                <br>
                <br></br>
                <asp:Label ID="ContentLabel1" runat="server" BorderColor="#33CCFF" 
                    BorderStyle="Double" BorderWidth="2px" Height="100px" 
                    style="Font: font-family: 幼圆; font-size: larger; font-weight: bold;" 
                    Text='<%# Eval("Content_Text") %>' Width="100%"></asp:Label>
                <table style="width:100%;">
                    <tr>
                        <td class="style16">
                            <asp:TextBox ID="TextBox2" runat="server" BackColor="White" Font-Names="幼圆" 
                                ForeColor="Black" Height="20px" Width="100%">请在此填写回复内容...</asp:TextBox>
                        </td>
                        <td align="center">
                            <asp:Button ID="ReplyBt" runat="server" BackColor="#66CCFF" 
                                BorderStyle="Dashed" CommandName="reply" Font-Bold="True" Font-Italic="False" 
                                Font-Names="微软雅黑" Text="回   复" Width="70px" />
                            <asp:Button ID="DeleteBt" runat="server" BackColor="#66CCFF" 
                                BorderStyle="Dashed" CommandName="delete" Font-Bold="True" Font-Italic="False" 
                                Font-Names="微软雅黑" Text="删除" Width="70px" />
                        </td>
                    </tr>
                </table>    
            </ItemTemplate>
            <FooterTemplate>
                            <table style="width: 425px; height: 39px;" cellpadding="0" cellspacing="0">
                                <tr>
                                    <td style="width: 71px; height: 4px" valign="middle">
                                        共有<asp:Label ID="labCount" runat="server" ForeColor="#FF3300" Width="12px"/>页</td>
                                    <td style="width: 73px; height: 4px" valign="middle">
                                        当前<asp:Label ID="labNowPage" runat="server" ForeColor="Brown">1</asp:Label>页</td>
                                    <td style="width: 46px; height: 4px" valign="middle">
                                        <asp:LinkButton ID="lnkbtnFirst" runat="server" CommandName="first"
                                            Font-Underline="False" ForeColor="Black" Width="43px">首页</asp:LinkButton></td>
                                    <td style="width: 55px; height: 4px" valign="middle">
                                        <asp:LinkButton ID="lnkbtnFront" runat="server" CommandName="pre" 
                                            Font-Underline="False" ForeColor="Black" Width="62px">上一页</asp:LinkButton></td>
                                    <td style="width: 51px; height: 4px" valign="middle">
                                        <asp:LinkButton ID="lnkbtnNext" runat="server" CommandName="next"
                                            Font-Underline="False" ForeColor="Black" Width="61px">下一页</asp:LinkButton></td>
                                    <td style="width: 29px; height: 4px" valign="middle">
                                        <asp:LinkButton ID="lnkbtnLast" runat="server" Font-Overline="False" CommandName="last"
                                            Font-Underline="False" ForeColor="Black" Width="38px">尾页</asp:LinkButton></td>
                                </tr>
                            </table>
                        </FooterTemplate>
            <SelectedItemStyle BackColor="#738A9C" Font-Bold="True" ForeColor="#F7F7F7" />
        </asp:DataList>
         </div>
                </td>         
            </tr>
        </table>
    <asp:SqlDataSource ID="MessageSource1" runat="server" 
        ConnectionString="<%$ ConnectionStrings:ConnectionString %>" 
        
            
            SelectCommand="SELECT Message.MessageID, y.UserName,Message.FisheryID, Message.Content_Text, Message.Time FROM Message INNER JOIN Users AS x ON Message.ReceiverID = x.UserID INNER JOIN Users AS y ON Message.SenderID = y.UserID  WHERE (x.UserID = @userID) ORDER BY Message.Message_Type desc, Message.Time DESC" 
            DeleteCommand="DELETE FROM Message WHERE (MessageID = @MessageID)" 
            ProviderName="<%$ ConnectionStrings:ConnectionString.ProviderName %>">
        <DeleteParameters>
            <asp:ControlParameter ControlID="DataList1" Name="MessageID" 
                PropertyName="SelectedValue" />
        </DeleteParameters>
        <SelectParameters>
            <asp:SessionParameter Name="userID" SessionField="userID" />
        </SelectParameters>
    </asp:SqlDataSource>
    </div>
</asp:Content>
